# This code is part of the MWP System
# Copyright (c) 2012 Benjamin Lubin (blubin@bu.com) 
# Published under and subject to the GPLv2 license available at http://www.gnu.org/licenses/gpl-2.0.html

'''
Created on Dec 14, 2012
@author: blubin
'''

from frontend.roleApplication import RoleApplication;
from frontend.form import Type;

class FarmerApplication(RoleApplication):
    """ The Farmer User Interface """
    def __init__(self):
        super(FarmerApplication, self).__init__("CoffeeImport", "farmer");
        self.register_source_step("alertf", self.sample_form_creator);
        self.register_transition_step("sendSample", self.send_sample_form_creator, name_fields=["Type"]);
        self.register_transition_step("sendFull", self.send_amt_form_creator, name_fields=["Type"]);

    def sample_form_creator(self, Sample, form): 
        form.add_html_label('<B>Is the harvest ready to sample?:</B>')
        form.add_field(Type.BOOLEAN, "alertf", labeltext="Sample Ready");
        form.add_html_label('<I>Please Name The Sample:</I>')
        form.add_field(Type.SHORTSTRING, "Type", labeltext="Coffee Type", initial="Please Enter Type Here");
        form.add_field(Type.DATE, "dateHarvested", labeltext= "Date Harvested");
        form.add_field(Type.SHORTSTRING, "Price", labeltext= "Price Per Pound", initial= "Please enter price per pound")
    def send_sample_form_creator(self, Sample_Information, form):    
        form.add_field(Type.BOOLEAN, "sendSample", labeltext = "Sample Sent")
    def send_amt_form_creator(self, Sample_Information, form):  
        form.add_field(Type.BOOLEAN, "sendFull", labeltext = "Amount Sent")
        
        
                
        
if __name__ == '__main__':
    app = FarmerApplication();
    app.MainLoop();